package utils 
{
	/**
	 * ...
	 * @author Dmitriy Gaiduk
	 */
	public class ErrorsCollector 
	{
		private static var _instance:ErrorsCollector;
		private var _errors:Vector.<String>;
		
		public function ErrorsCollector() 
		{
			if (_instance != null)
			{
				throw new Error("ErrorsCollector allready exist");
			}
			_errors = new Vector.<String>();
			
		}
		
		public static function getInstance():ErrorsCollector
		{
			if (_instance == null)
			{
				_instance = new ErrorsCollector();
			}
			return _instance;
		}
		
		public static function collectError(errMsg:String):void
		{
			getInstance().collectError(errMsg);
		}
		
		public function collectError(errMsg:String):void
		{
			trace(errMsg);
			_errors.push(errMsg);
			
		}
		
		public function get errors():Vector.<String> 
		{
			return _errors;
		}
		
	}

}